//
//  application.h
//  mbstore
//
//  Created by huangyi on 14-3-12.
//  Copyright (c) 2014年 huangyi. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSString (Hash)

-(NSString*)MD5String;
-(NSString*)urlencode;

-(id)JSONObject;

-(NSString*)resourcePath;
-(NSData*)readData;
-(NSString*)readString;

@end

@interface UIView (BarButtonItem)

-(UIBarButtonItem*)barButtonItem;
-(void)removeAllSubviews;
-(void)runTask:(dispatch_block_t)block;

@end

@interface UIButton (ImageButton)

+(instancetype)buttonWithImage:(NSString*)image;

@end

@interface UIImageView (WebImage)

-(NSString*)filePathForImageURL:(NSString*)urlstring;
-(void)setImageURL:(NSString*)urlstring;
-(NSString*)getImageURL;
-(void)fetchImageFromURL:(NSString*)urlstring;

@end

@interface NibLoader : NSObject

@property(nonatomic,strong)IBOutlet UIView *nibView;

+(UIView*)loadNib:(NSString*)nibName;
+(UIView*)loadNib:(NSString*)nibName bundle:bundle;

@end

@interface WebService : NSObject

@property(nonatomic,strong)NSError *error;
@property(nonatomic,strong)id response;

+(instancetype)serviceWithApi:(NSDictionary*)api;
-(void)setApi:(NSDictionary*)api;
-(void)execute;

@end

@interface NSArray (List)

-(BOOL)containsString:(NSString*)string;
-(NSArray*)arrayByRemoveNullValue;
-(NSString*)JSONString;

@end

@interface NSDictionary (List)

-(NSDictionary*)dictionaryByRemoveNullValue;
-(NSString*)JSONString;

@end

@interface NSObject (Payload)

@property(nonatomic,strong)id payloadObject;

@end

@interface NSData (JSON)

-(id)JSONObject;

@end
